package com.tuocent.dagv2.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tuocent.dagv2.entity.Task;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 * 任务管理 Mapper 接口
 * </p>
 *
 * @author Vincent
 * @since 2025-07-22
 */
@Mapper
public interface TaskMapper extends BaseMapper<Task> {

    String userTaskSql = "select a.*, b.isuse from db_task as a , sys_user_permission as b  " +
            "where a.id=b.keyid and b.model=11 and b.isuse='1' and a.is_del='0' and " +
            "b.userid=#{userId} and a.pid=#{pid}";

    @Select(userTaskSql)
    List<Task> userTask(@Param("userId") String userId, @Param("pid") String pid);


    @Select(userTaskSql)
    <P extends IPage<Task>> P userTaskInfo(P page, @Param("userId") String userId, @Param("pid") String pid);

}

